package cn.edu.dao;

import cn.edu.domain.All;
import cn.edu.domain.PieData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Davey chan
 */
@Mapper
public interface Col_InfomationDao {
    //   获得论文的数量
    @Select("select count(*) from thesis a,teacher b where a.teacherID=b.teacherID and b.academyName like #{academyName}")
    int GetthesisNum(@Param("academyName") String academyName);
    //    获得专利的数量
    @Select("select count(*) from patent a,teacher b where a.teacherID=b.teacherID and b.academyName like #{academyName}")
    int GetPatentNum(@Param("academyName") String academyName);
    //获得著作的数量
    @Select("select count(*) from opus a,teacher b where a.teacherID=b.teacherID and b.academyName like #{academyName}")
    int GetOpsNum(@Param("academyName") String academyName);
    //获得科研项目数的数量
    @Select("select count(*) from research_project a,teacher b where a.teacherID=b.teacherID and b.academyName like #{academyName}")
    int Getresearch_projectNum(@Param("academyName") String academyName);
    //    教授的数量
    @Select("select count(*) from teacher where title='教授' and academyName like #{academyName}")
    int GetprofessorNum(@Param("academyName") String academyName);
    //    副教授的数量
    @Select("select count(*) from teacher where title='副教授'and academyName like #{academyName}")
    int GetAsprofessorNum(@Param("academyName") String academyName);
    //    讲师的数量
    @Select("select count(*) from teacher where title='讲师'and academyName like #{academyName}")
    int GetLecturerNum(@Param("academyName") String academyName);

    //查询各年份合格人数的数量
    @Select("select count(*) from annual_examination a,teacher b where b.academyName like #{academyName} and a.teacherID=b.teacherID group by checkYear order by checkYear ASC ")
    List<Integer> GetExamine(@Param("academyName") String academyName);

    //查询各个获奖的情况
    @Select("select awardName as name,count(*) as `value` " +
            "from award a,teacher b " +
            "where a.teacherID=b.teacherID and b.academyName " +
            "like #{academyName} and awardTime like #{year}  group by awardName;")
    List<PieData> GetAward(@Param("academyName") String academyName,@Param("year") String year);
    //    信息页面的分页查询

    //下面这两个没有用上可以删除
    List<All> Infoselect(@Param("begin") int begin, @Param("size")int size, @Param("t") All t);
    int selectTotalCountByCondition(All t);
}
